from selenium.webdriver.common.by import By
from Day_2211A.Package.Base import Base


class Page(Base):
    # 定位器
    search_loc = (By.ID, 'kw')
    pf_loc = (By.XPATH, '//*[@id="u"]/a[2]')
    search_set = (By.XPATH, '//*[@id="u"]/div/a[1]/span')

    # 页面元素的封装
    def search(self):
        self.find_element(self.search_loc).send_keys('UI自动化测试')
        self.move_to_element(self.pf_loc)
        self.click(self.pf_loc)
        self.click(self.search_set)

    # 业务逻辑
    def luoji_baidu(self):
        self.open_url('https://www.baidu.com/')
        self.search()